var path = require("path");
var webpack = require("webpack");
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
    entry: {
        vendor: [path.join(__dirname, "js", "vendors.js")]
    },
    output: {
        path: path.join(__dirname, "build"),
        filename: "[name].bundle.js",
        library: "[name]"
    },
    module: {
        loaders: [{
            test: /\.js$/,
            loader: 'babel?{"presets":["es2015"]}'
        }, {
            test: /\.css$/,
            loader: ExtractTextPlugin.extract('css')
        }, {
            test: /\.less$/,
            loader: ExtractTextPlugin.extract('css!less')
        }, {
            test: /\.(png|jpg)$/,
            loader: 'url?limit=15000'
        }, {
            test: /\.(woff|woff2|svg|eot|ttf|svg)$/,
            loader: 'url?limit=15000'
        }]
    },
    plugins: [
        new webpack.DllPlugin({
            path: path.join(__dirname, "[name]-manifest.json"),
            name: "[name]",
            context: path.resolve(__dirname)
        }),
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.optimize.UglifyJsPlugin({
            compress: {
                warnings: false
            }
        }),
        new ExtractTextPlugin('vendor.bundle.css')
    ],
    resolve: {
        root: path.resolve(__dirname),
        modulesDirectories: ["node_modules"],
        alias: {
            'bootstrap-less':'bootstrap/less/bootstrap.less'
        }
    }
};
